<?php

namespace App\Models\banner;

use App\Common\statement\CommonStatement;
use App\Models\base\traits\ImgTrait;
use Illuminate\Database\Eloquent\Model;

/**
 * App\Models\banner\Banner
 *
 * @property int $id 主键
 * @property string $title 简介
 * @property string $url 广告轮播图链接地址
 * @property int $cid 分类id
 * @property string $img 图片地址
 * @property int $type 跳转类型  1=>外链  2=>app内部模块
 * @property \Illuminate\Support\Carbon|null $created_at
 * @property \Illuminate\Support\Carbon|null $updated_at
 * @property int $status 1正常  0禁用
 * @property int $sort
 * @property-read \App\Models\banner\BannerCate $cate
 * @property-read mixed $header_img
 * @property-read mixed $icon
 * @property-read mixed $imgs
 * @property-read mixed $type_text
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\banner\Banner newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\banner\Banner newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\banner\Banner query()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\banner\Banner whereCid($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\banner\Banner whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\banner\Banner whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\banner\Banner whereImg($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\banner\Banner whereSort($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\banner\Banner whereStatus($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\banner\Banner whereTitle($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\banner\Banner whereType($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\banner\Banner whereUpdatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\banner\Banner whereUrl($value)
 * @mixin \Eloquent
 * @property mixed $icons
 * @property mixed $parameter
 */
class Banner extends Model
{
    use ImgTrait;

    protected $table = 'banner';

    public function cate()
    {
        return $this->hasOne(BannerCate::class, 'id','cid');
    }

    protected $appends = ['type_text'];

    public function getTypeTextAttribute()
    {
        return CommonStatement::banner_jump_type[$this->type];
    }



}
